Skip to content

sonic-utilities: Add 'default' option for sFlow#845

Closed
GarrickHe wants to merge 1 commit intosonic-net:masterfrom
GarrickHe:sflow-cli
Closed

sonic-utilities: Add 'default' option for sFlow#845
GarrickHe wants to merge 1 commit intosonic-net:masterfrom
GarrickHe:sflow-cli

Conversation

@GarrickHe
Copy link
Contributor

@GarrickHe GarrickHe commented Mar 18, 2020

  • Adding the 'default' option to allow user to set an interface's
    sFlow sampling-rate back to default.

Signed-off-by: Garrick He garrick_he@dell.com

- What I did
Add a 'default' option so users can revert to the default sFlow sampling-rate on an interface.

IMPORTANT:
DO NOT MERGE UNTIL THIS PR IS MERGED:
sonic-net/sonic-swss#1224

- How I did it
Updated the config script in config/main.py.

- How to verify it
Unit-test:

root@sonic:~# show sflow interface | less

sFlow interface configurations
+-------------+---------------+-----------------+
| Interface   | Admin State   |   Sampling Rate |
+=============+===============+=================+
| Ethernet0   | up            |            4000 |
+-------------+---------------+-----------------+
| Ethernet4   | up            |            4000 |
+-------------+---------------+-----------------+
| Ethernet8   | up            |            4000 |
+-------------+---------------+-----------------+
| Ethernet12  | up            |            4000 |
+-------------+---------------+-----------------+
| Ethernet16  | up            |            4000 |
+-------------+---------------+-----------------+

root@sonic:~# config sflow interface sample-rate Ethernet0 222
Error: Sample rate must be between 256 and 8388608 or default
root@sonic:~# config sflow interface sample-rate Ethernet0 333
root@sonic:~# config sflow interface sample-rate Ethernet4 444
root@sonic:~# show sflow interface | less

sFlow interface configurations
+-------------+---------------+-----------------+
| Interface   | Admin State   |   Sampling Rate |
+=============+===============+=================+
| Ethernet0   | up            |             333 |
+-------------+---------------+-----------------+
| Ethernet4   | up            |             444 |
+-------------+---------------+-----------------+


root@sonic:~# config sflow interface sample-rate Ethernet0 default
root@sonic:~# config sflow interface sample-rate Ethernet4 default
root@sonic:~# config sflow interface sample-rate Ethernet8 default
root@sonic:~# show sflow interface | less

sFlow interface configurations
+-------------+---------------+-----------------+
| Interface   | Admin State   |   Sampling Rate |
+=============+===============+=================+
| Ethernet0   | up            |            4000 |
+-------------+---------------+-----------------+
| Ethernet4   | up            |            4000 |
+-------------+---------------+-----------------+
| Ethernet8   | up            |            4000 |
+-------------+---------------+-----------------+

Notice Ethernet0/4 has their sampling-rate restored to default (4000), but if I apply 'default' to a interface (Ethernet8) that is already using default sampling-rate nothing will happen.

- Previous command output (if the output of a command-line utility has changed)
This is a new option to an existing command. No previous output available.

- New command output (if the output of a command-line utility has changed)
See unit-test

* Adding the 'default' option to allow user to set an interface's
  sFlow sampling-rate back to default.

Signed-off-by: Garrick He <garrick_he@dell.com>
@GarrickHe
Copy link
Contributor Author

retest this please

@lguohan
Copy link
Contributor

lguohan commented Mar 22, 2020

can you update the doc as well?

@GarrickHe
Copy link
Contributor Author

can you update the doc as well?

@lguohan - Yes, I will update the sFlow HLD and command-line reference as well.

@venkatmahalingam
Copy link
Contributor

Raised the new PR #1606 with conflict resolution, please close this PR.

@prsunny prsunny closed this May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants